<template>
  <view v-if="shenheStatus == 0" class="diy-my-page">
    <classifyPage ref="classifyPage"></classifyPage>

    <goodsAddCart :good="good"></goodsAddCart>

    <transitionPage></transitionPage>
  </view>
  <Shenhe v-else-if="shenheStatus == 1"></Shenhe>
</template>

<script>
import Shenhe from "@/components/shenhe/shenhe";
import classifyPage from "@/components/diySystemPage/classifyPage/index.vue";
import goodsAddCart from "@/components/diyNew/goodsAddCart/index.vue";

export default {
  components: {
    classifyPage,
    goodsAddCart,
    Shenhe,
  },
  data() {
    return {
      good: {},
    };
  },
  onLoad() {
    uni.$on("diyAddGood", this.toAddcart);
  },
  onShow() {
    const isLogin = this.$utils.isLogin(false);
    if (!isLogin) {
      this.$store.commit("setNoLoginTabarPath", "/pages/cat/cat");
      this.$store.commit("setRouteType", "switchtab");
    }
  },
  onHide(){
    this.$store.commit("setGoCatId", "");
  },
  methods: {
    toAddcart(e) {
      this.good = JSON.parse(JSON.stringify(e));
      setTimeout(() => {
        this.good = {};
      }, 1);
    },
  },
};
</script>

<style lang="scss" scoped>
.diy-my-page {
  width: 100%;
}
</style>
